package com.mayjean.redis.lock;

import cn.hutool.core.util.StrUtil;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * redis Lock
 *
 * @author
 */
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Lock {
	/**
	 * @return key
	 */
	String key();

	/**
	 * for key + params 's cache, support sePL
	 *
	 * @return value
	 */
	String params() default StrUtil.EMPTY;

	/**
	 * lock expire time
	 *
	 * @return value
	 */
	long expireMills();

	/**
	 * retry times
	 *
	 * @return
	 */
	int retryTimes() default IRedisLock.RETRY_TIMES;

	/**
	 * set redis key value after，sleep time（cluster sync，standalone set zero）
	 *
	 * @return value
	 */
	long sleepMills() default IRedisLock.SLEEP_MILLIS;


}
